define(
		[], 
		function() {
    return function(content, loading) {
    	var token = localStorage.getItem("token");
        loading.hide();
        var jobDate = content.find("[name='outgoingStart']");
        jobDate.val(new Date().format());
        jobDate.click(function() {
            var d = new Date();
            var d1 = new Date();
            d1.setDate(d.getDate() - 1);
            var d2 = new Date();
            d2.setDate(d.getDate() + 5);
            weui.datePicker({
                start: d1.format(),
                end: d2.format(),
                cron: '* * *',
                onChange: function(result) {
                    jobDate.val(result[0].value + "-" + result[1].value + "-" + result[2].value);
                },
                onConfirm: function(result) {
                    jobDate.val(result[0].value + "-" + result[1].value + "-" + result[2].value);
                }
            });
        });

        var form = content.find("form");
       


        form.submit(function(e) {
			loading = weui.loading("数据提交中");
            var ps = form.serializeArray();
            ps.push({name:"token",value:token});
            $.post(
        		"outgoing/add.do",
				ps,
				function(data){
					loading.hide();
					if(data.ok){
						weui.toast('保存成功', 2000);
						history.back();
					}else{
						weui.topTips(data.message);
					}
				},"json"
            );

            return false;
        });

    }
});